
/***************************************************************************************
****************************************************************************************
* FILE		: led.c
* Description	: 
*			  
* Copyright (c) 2020 by Simlife. All Rights Reserved.
* 
* History:
* Version		Name		Date				Description
   0.1		Alen			2020/05/07		Initial Version
   
****************************************************************************************
****************************************************************************************/

#include "includes.h"

void initLEDControlPin(void)
{
	powerLedTypeControl &= powerLedPinReverse;	 //output
	powerLedPullUpControl &= powerLedPinReverse; //no pull up
	POWER_LED_OFF();
}

void closeLEDPin(void)
{
	POWER_LED_OFF();
}

void systemLEDProcess(void) //250ms call
{
	if (flagSystemLowPower)
	{
		POWER_LED_SWITCH();
	}
	else
	{
		if (stTime.countLEDFLASH != 0)
		{
			stTime.countLEDFLASH--;
			if (stTime.countLEDFLASH == 0)
			{
				POWER_LED_ON();
			}
			else
			{
				POWER_LED_SWITCH();
			}
		}
	}
}

void chargeLEDProcess(void) //500ms
{
	if (flagSystemCharge)
	{
		if (flagSystemChargeFull)
		{
			POWER_LED_ON();
		}
		else
		{
			POWER_LED_SWITCH();
		}
	}
	else
	{
		POWER_LED_OFF();
	}
}
